package com.shujia.mvc2.controller;

import com.shujia.mvc2.service.UserService;
import com.shujia.mvc2.service.UserServiceIpm1;

/**
 * 控制层
 * <p>
 * 主要和用户交互
 */
public class UserController {

    //构建业务层对象
    //多态：父类的引用指向子类的对象
    UserService userService = new UserServiceIpm1();

    public String login(String username, String password) {

        //调用登录方法
        String login = userService.login(username, password);

        //返回结果
        return login;
    }

    public String register(String username, String password, String password1) {

        //调用注册方法
        String register = userService.register(username, password, password1);

        //放回结果
        return register;
    }

    public String modifyPassword(String username, String oldPassword, String newPassword, String nowPassword) {

        //调用注册方法
        String modifyPassword = userService.modifyPassword(username, oldPassword, newPassword, nowPassword);

        //放回结果
        return modifyPassword;
    }
}
